//
// Created by ap on 2021/5/20.
//


#include <unistd.h>
#include <thread>
#include "ThreadTest.h"
#include "pthread.h"
#include "EventManager.h"

void ThreadTest::sleepThread() {
    std::thread cal_task(&ThreadTest::makeSleep, this);
    cal_task.detach();
}

void ThreadTest::makeSleep() {
    sleep(2);
    EventData eventData = EventManager::singleton().getEventData(eeSleepWake);
    onSleepWake wake = (onSleepWake)eventData.eventPointer;
    if(wake) {
        wake(12345, eventData.sender);
    }
}


